/*
Naijanimi Free SMS Application for Nokia mobiles.

"Naijanimi Free SMS Application" is protected by the copyright law
(c) 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
Distributed under the LGPL 3.0 license.

This file is part of "Naijanimi Free SMS Application".

    "Naijanimi Free SMS Application" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "Naijanimi Free SMS Application" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "Naijanimi Free SMS Application".
    If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

// Main layout item defines the introductory text and
Item {
    id: mainChoice

    // sizes values are for testing only, real dimensions are
    // set when the object is instantiated.
    width: 300; height: 400

    signal btnloginClicked
    signal btnregisterClicked


    // ---------------------------------------------------------- START DEBUG BLOCK
    // Debug info.
    // For debug console messages use debugMessage(msg) instead of console.log(msg)
    // in the source module set baseMsg property with the string that should appear
    // before any debug message on the console.
    // To disable debug, set debugStatus to false. This can be done also only in some
    // code blocks.
    property bool debugStatus: true
    property string baseMsg: "*** Debug MainLayout: "
    function debugMessage(msg) { if (debugStatus == true) console.log(baseMsg + msg); }
    // ---------------------------------------------------------- END DEBUG BLOCK


WorkingBackground {
    id: layoutBackground

    width: parent.width
    height: parent.height
}

    // Introductory text
    Text {
        id: text2

        x: 28; y: 155; width: 250; height: 20;
        text: "Naijanimi Free SMS lets you to manage your SMS sending them for free.\n" +
              "If it is the first time, please register online or login to use the program"
        smooth: true
        wrapMode: Text.WordWrap
    }

    // Logo image near the title
    Image {
        id: logo

        x: 0; y: 25;
        width: 100; height: 100
        transformOrigin: Item.TopLeft
        rotation: -12
        anchors.top: parent.top
        anchors.topMargin: 25
        fillMode: Image.PreserveAspectFit
        smooth: true
        scale: 0.7
        source: "images/app_flag.png"
    }

    // Space to insert ad banner, now with SMS Kiosk logo
    Image {
        id: adBanner

        scale: (parent.width / adBanner.width) * 0.6
        fillMode: Image.PreserveAspectFit
        anchors.verticalCenter: parent.verticalCenter
        anchors.verticalCenterOffset: parent.height * 0.10
        anchors.horizontalCenter: parent.horizontalCenter
        source: "images/SMSKiosk.png"
    }

    // Page title
    Text {
        id: title

        x: parent.width * .10
        y: parent.height * .10
        color: "#373737"
        text: "Welcome!"
        style: Text.Normal
        wrapMode: Text.NoWrap
        font.bold: true
        font.pointSize: 12
        font.family: "Tahoma"
        smooth: true
    }

    // Choice buttons
    Column {
        id: buttons

        property int buttonHeight: 55

        spacing: 1
        width: parent.width
        scale: 1
        transformOrigin: Item.Center
        clip: false
        visible: true

        // Anchors buttons to the bottom of the screen
        anchors {
            bottom: parent.bottom
            horizontalCenter: parent.horizontalCenter
        }

        Button {
            id: btnlogin

            width: buttons.width; height: buttons.buttonHeight
            color: 'blue'; operation: "Login"
            onClicked: { mainChoice.btnloginClicked(); debugMessage("btnloginClicked()") }
        }

        Button {
            id: btnregister

            width: buttons.width; height: buttons.buttonHeight
            color: 'blue'; operation: "Register"
            onClicked: { mainChoice.btnregisterClicked() }
        }
    }
}
